<?php

namespace App\Providers;

use App\Setting;
use Carbon\Carbon;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\DomCrawler\AbstractUriElement;

class AppServiceProvider extends ServiceProvider
{
    protected $site_config;
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //Auth::guard('member')->loginUsingId(111);

        if(env('isAdmin')==true){
            Auth::guard('admin')->loginUsingId(1);
        }
       // Auth::loginUsingId(1);
        //定义字段默认长度
        Schema::defaultStringLength(191);
        Carbon::setLocale('zh');
        \Validator::extend('identityCards', function($attribute, $value, $parameters) {
            return preg_match('/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/', $value);
        });

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }
}
